#include <stdio.h>
#pragma pack(1)//指定结构体对齐的大小
typedef struct hehe
{
	unsigned char				name;
	unsigned char				id;
	unsigned char				number;
	unsigned char				text;
}led;

typedef struct haha
{
	unsigned char				aa;
	int							bb;
	unsigned short				cc;	
}world;
int main()
{
	world				test1;
	world				*pot1;
	led					test2;
	led					*pot2;
	unsigned char		buf[64]={"hello world!"};
	int					i=1;
	
	pot1=(world *)&buf[i];//指针新用法
	
	printf("led:%d\n",sizeof(test2));
	printf("world:%d\n",sizeof(test1));
	
	pot2=(led *)&buf[i];
	printf("id:0x%02x\n",pot2->id);
	printf("number:0x%02x\n",pot2->number);
	printf("text:0x%02x\n",pot2->text);

	for(i=0;i<8;i++)
	printf("与数组的对比0~8:0x%02x\n",buf[i]);
	
	printf("aa:0x%02x\n",pot1->aa);
	printf("bb:0x%02x\n",pot1->bb);
	printf("cc:0x%02x\n",pot1->cc);
	return 0;	
}
